<template>
    <div class="index clearafter">
        <module-head keep-alive></module-head>
        <div class="content flex">
            <div class="w220">
                <menu-list keep-alive></menu-list>
            </div>
            <div class="w980 flex_full">
                <div class="index_con flex">
                    <div class="fl w650 wjz">
                      <common-box2>
                        <div class="h2_index flex flex_between">
                          <span class="fRedBig">危急值</span>
                          <a href="javascript:void(0)" class="fr" @click = "refresh">刷新</a>
                        </div>
                        <div class="contain">
                          <div class="block" v-for="item in dangerRecordlist" track-by="$index">
                            <div class="block_con1">
                              <span class="fl"> {{item.personName}} {{item.itemName}}</span>
                              <span class="fr">{{item.occurTime}}</span>
                            </div>
                            <div class="block_con2 cbafter">
                              <p class="fl">{{item.sourceTypeText}}</p>
                              <div class="fl">
                                <p><span>{{item.indexName}}</span><span :class="{'zhibiao2':parseFloat(item.indexVal)<parseFloat(item.normalValBottom),'zhibiao':parseFloat(item.indexVal)>parseFloat(item.normalValTop)}">{{item.indexVal}} {{item.indexUnit}}</span></p>
                              </div>
                              <button class="fr" @click="dealdangerrecord(item)">马上处理</button>
                            </div>
                          </div>
                        </div>
                      </common-box2>
                    </div>
                    <div class="w290 flex_full">
                      <common-box2>
                        <div class="h2_index flex flex_between">
                          <span class="fRedBig">咨询问答</span>
                          <a href="javascript:void(0)" class="fr" @click = "refresh">刷新</a>
                        </div>
                        <ul class="zxwd">
                          <li v-for="item in roster_lists">
                            <span></span>
                            <span>{{item.name}}</span>
                            <span></span>
                            <span></span>
                            <span></span>
                          </li>
                        </ul>
                      </common-box2>
                    </div>
                </div>
              <div class="mt20"></div>
              <common-box2>
                <div class="need_dealt cb">
                  <div class="h2_index">
                    <span class="fRedBig">今日待办事项</span>
                  </div>
                  <ul class="list">
                    <li v-for="(index,item) in affairServicelist" :class="{over:item.dealFlag==1}" track-by="$index">
                      <p>{{item.affairTypeName}}</p>
                      <p :class="{lh24:item.iswarp}">{{item.affairDesc}}</p>
                      <p class="flex flex_between flex_vcenter">
                        <button class="normalBtn" v-for="subitem in item.list" @click="dealaffair(subitem,item,index)" v-if="item.dealFlag==0" track-by="$index">{{subitem.operateName}}</button>
                        <!-- <button class="disagree">不同意</button> -->
                      </p>
                      <p>{{item.affairTime.substr(0,11)}}</p>
                    </li>
                  </ul>
                </div>
              </common-box2>
            </div>
        </div>
        <!-- 保存成功提示 -->
        <div class="modal fade" id="successsaveinfo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <!--  <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title" id="myModalLabel">
                服务本体信息提示
                    </div> -->
                    <div class="modal-body threestep_con">
                        <h2>是否确认完成该事项？</h2>
                    </div>
                    <div class="form-group tbline text-center">
                        <div class="col-md-6">
                            <button class="default blue center fr" @click="dealed()">确定</button>
                        </div>
                        <div class="col-md-6">
                            <button class="default greynobg center fl" data-dismiss="modal">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 电话咨询申请同意和拒绝弹框 -->
        <div class="modal fade" id="phoneapply" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <!--  <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title" id="myModalLabel">
                服务本体信息提示
                    </div> -->
                    <div class="modal-body threestep_con">
                        <h2>是否{{phoneapply.text}}</h2>
                    </div>
                    <div class="form-group tbline text-center">
                        <div class="col-md-6">
                            <button class="default blue center fr" @click="phoneapplyconfirm()">确定</button>
                        </div>
                        <div class="col-md-6">
                            <button class="default greynobg center fl" data-dismiss="modal">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 更换主管医生审核 -->
        <div class="modal fade" id="editexamine" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title" id="myModalLabel">
                更换主管医生审核</h4>
                    </div>
                    <div class="changeinfo cbafter">
                        <div class="changeinfo_head cbafter">
                            <span class="text-left">申请人：{{examineinfo.look.applyUserName}}</span>
                            <span class="text-right">申请时间：{{examineinfo.look.applyTime.substring(0,10)}}</span>
                        </div>
                        <div class="cb changeinfo_con">
                            <div class="content1">
                                <p><span>{{examineinfo.look.personName}}</span>{{examineinfo.look.chronicName}}</p>
                                <p>证件号码：{{examineinfo.look.idOrNo}}</p>
                            </div>
                            <div class="content2">
                                <p><img :src="imgdoc1"><span>{{examineinfo.look.oldMangerName}}</span>{{examineinfo.look.oldMangerLevelText}}</p>
                                <p><img :src="jiantou">更换为</p>
                                <p><img :src="imgdoc1"><span>{{examineinfo.look.newMangerName}}</span>{{examineinfo.look.newMangerLevelText}}</p>
                            </div>
                            <div class="content3"><span>更换原因：</span>{{examineinfo.look.changeReason}}</div>
                        </div>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" role="form" id="changedocform" v-on:submit.prevent="subexamine">
                            <div class="form-group">
                                <label for="" class="col-md-3 control-label" style="padding-top:15px">审核意见：</label>
                                <div class="col-md-8">
                                    <div class="radio">
                                        <label class="checkbox-inline">
                                            <input type="radio" name="examineinfo" value="1" required v-model="examineinfo.sub.applyStatus">通过
                                        </label>
                                        <label class="checkbox-inline">
                                            <input type="radio" name="examineinfo" value="2" required v-model="examineinfo.sub.applyStatus">不通过
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group" v-if="examineinfo.sub.applyStatus==2">
                                <label for="" class="col-md-3 control-label">不通过理由 :</label>
                                <div class="col-md-8">
                                    <textarea class="form-control" rows="3" placeholder="请输入审核不通过的理由" v-model="examineinfo.sub.refuseReason" :required="examineinfo.sub.applyStatus==2"></textarea>
                                </div>
                            </div>
                            <div class="form-group save">
                                <button type="submit" class="default center ok">确认</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <!-- 设置健康顾问 -->
        <div class="modal fade" id="sethealdoc" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title" id="myModalLabel">
                设置健康顾问</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" role="form" id="changehealdocform" v-on:submit.prevent="changehealdoc">
                            <div class="form-group">
                                <label for="" class="col-md-3 control-label">会员姓名 :</label>
                                <div class="col-md-6">
                                    <input type="text" disabled class="form-control" v-model="selfInfo.personName">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="" class="col-md-3 control-label">会员性别 :</label>
                                <div class="col-md-6">
                                    <input type="text" disabled class="form-control" v-model="selfInfo.sexText">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="" class="col-md-3 control-label">会员年龄 :</label>
                                <div class="col-md-6">
                                    <input type="text" disabled class="form-control" v-model="selfInfo.dob">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="" class="col-md-3 control-label">手机号码 :</label>
                                <div class="col-md-6">
                                    <input type="text" disabled class="form-control" v-model="selfInfo.phoneNo">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="" class="col-md-3 control-label">健康顾问 :</label>
                                <div class="col-md-6">
                                    <label class="radio-inline" v-for="item in HealthDoctorlist">
                                        <input type="radio" name="healthdoc" value="{{item.doctorId}}" v-model="selecthealdoc" required />{{item.doctorName}}
                                    </label>
                                </div>
                            </div>
                            <div class="form-group save">
                                <button type="submit" class="default ok center">确认</button>
                                <!--  <button type="button" class="btn btn-warning" @click="cancelchangehealdoc">取消</button> -->
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <!-- 危急值处理通知 -->
        <div class="modal fade" id="noticeselect" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title" id="myModalLabel">
                危急值处理通知</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" v-model="allnotice"> 全部通知
                                </label>
                            </div>
                        </div>
                        <div class="form-group selectnoticepeople cbafter">
                            <ul>
                                <li :class="{noselect:item.noticeStauts==0}" v-for="item in dangerNoticelist" @click="changenoticeStauts(item)" track-by="$index">
                                    <img :src="headimg" />
                                    <p>{{item.noticeObjectName}} <span>{{item.noticeObjectTypeText}}</span></p>
                                    <p class="iphone">{{item.noticeObjectPhone}}</p>
                                    <div class="righttip" :class="{righttip2:item.noticeStauts==0}"></div>
                                </li>
                            </ul>
                        </div>
                        <ul>
                        </ul>
                    </div>
                    <div class="modal-footer">
                        <div class="form-group save">
                            <button class="default blue center" @click="savedangerNotice">确认</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 修改会员信息弹出框组件 -->
        <member-edit v-ref:memberedit></member-edit>
        <!-- 健康讲座修改 -->
        <healtalk-edit :modaltitle="modaltitle" :username="username" :applytime="applytime" :uploadfilename="uploadfilename" :imgurl="imgurl" v-ref:addhealthtalk></healtalk-edit>
        <!-- 健康讲座作废 -->
        <healtalk-dele :modaltitle="modaltitle" :username="username" :applytime="applytime" :uploadfilename="uploadfilename" :imgurl="imgurl" v-ref:delehealthtalk></healtalk-dele>
        <!-- 健康讲座审核 -->
        <healtalk-verify :modaltitle="modaltitle" :username="username" :applytime="applytime" :uploadfilename="uploadfilename" :imgurl="imgurl" v-ref:verifyhealthtalk></healtalk-verify>
        <!-- 健康资讯者修改 -->
        <healnews-edit :modaltitle="modaltitlenews" :username="usernamenews" :applytime="applytimenews" :imgurl="imgurlnews" v-ref:addhealthnews></healnews-edit>
        <!-- 健康资讯作废 -->
        <healnews-dele :modaltitle="modaltitlenews" :username="usernamenews" :applytime="applytimenews" :imgurl="imgurlnews" v-ref:delehealthnews></healnews-dele>
        <!-- 健康资讯审核 -->
        <healnews-verify :modaltitle="modaltitlenews" :username="usernamenews" :applytime="applytimenews" :imgurl="imgurlnews" v-ref:verifyhealthnews></healnews-verify>
        <!-- 健康互动修改 -->
        <healinteract-edit :modaltitle="modaltitleinteract" :username="usernameinteract" :applytime="applytimeinteract" :uploadfilename="uploadfilenameinteract" :imgurl="imgurlinteract" v-ref:addhealthinteract></healinteract-edit>
        <!-- 健康互动作废 -->
        <healinteract-dele :modaltitle="modaltitleinteract" :username="usernameinteract" :applytime="applytimeinteract" :uploadfilename="uploadfilenameinteract" :imgurl="imgurlinteract" v-ref:delehealthinteract></healinteract-dele>
        <!-- 健康互动审核 -->
        <healinteract-verify :modaltitle="modaltitleinteract" :username="usernameinteract" :applytime="applytimeinteract" :uploadfilename="uploadfilenameinteract" :imgurl="imgurlinteract" v-ref:verifyhealthinteract></healinteract-verify>
        <!-- 回访记录 -->
        <revisit-record v-ref:revisitrecordmodel></revisit-record>
    </div>
</template>
<script>
var imgdoc1 = require("assets/img/imgdoc1.jpg");
var jiantou = require("assets/img/jiantou.png");
var headimg = require("assets/img/cs2.jpg");
import 'assets/lib/bootstrap-3.3.2/css/bootstrap.min.css'
import 'assets/lib/bootstrap-3.3.2/js/bootstrap.min.js'
import 'assets/lib/laydate/laydate.js'
import 'assets/lib/laydate/need/laydate.css'
import 'assets/lib/laydate/skins/danlan/laydate.css'
import 'assets/reset.css'
import Public from 'assets/public.js'
import moduleHead from 'components/module-head'
import menuList from 'components/menu-list'
import memberEdit from 'components/member-edit'
import healtalkEdit from 'components/healtalk-edit.vue'
import healtalkDele from 'components/healtalk-dele.vue'
import healtalkVerify from 'components/healtalk-verify.vue'
import healnewsEdit from 'components/healnews-edit.vue'
import healnewsDele from 'components/healnews-dele.vue'
import healnewsVerify from 'components/healnews-verify.vue'
import healinteractEdit from 'components/healinteract-edit.vue'
import healinteractDele from 'components/healinteract-dele.vue'
import healinteractVerify from 'components/healinteract-verify.vue'
import revisitRecord from 'components/revisit-record'
import commonBox2 from 'components/commonBox2'
export default {
    data() {
            return {
                headimg: headimg,
                roleId: "",
                roster_lists: [],
                affairServicelist: [],
                affair: {},
                affairindex: "",

                // 更换主管医生用start
                imgdoc1: imgdoc1,
                jiantou: jiantou,
                examineinfo: {
                    "sub": {
                        "applyStatus": "",
                        "changeId": "",
                        "refuseReason": ""
                    },
                    "look": {
                        "applyUserName": "",
                        "applyTime": "",
                        "personName": "",
                        "chronicName": "",
                        "idOrNo": "",
                        "oldMangerName": "",
                        "oldMangerLevelText": "",
                        "newMangerName": "",
                        "newMangerLevelText": "",
                        "changeReason": "",
                        "refuseReason": "",
                        "applyStatus": "" //判断显示成功还是失败用
                    }
                },
                // 更换主管医生用end
                // 设置健康顾问开始
                // 健康顾问列表
                HealthDoctorlist: [],
                selecthealdoc: "",
                usermpiId: "",
                selfInfo: {
                    sexText: "",
                    personName: "",
                    dob: "",
                    phoneNo: "",

                },
                // 设置健康顾问结束

                // 危急值处理开始
                dangerRecordlist: [],
                dangerNoticelist: [],
                allnotice: false,
                // 危急值处理结束
                //健康讲座公用的start
                username: sessionStorage.getItem('userName'),
                applytime: "",
                imgurl: "", //修改的时候文件预览
                uploadfilename: "", //修改的时候文件下载
                modaltitle: "",

                //健康讲座公用的end

                //健康资讯公用的start
                usernamenews: sessionStorage.getItem('userName'),
                applytimenews: "",
                imgurlnews: "", //修改的时候文件预览
                uploadfilenamenews: "", //修改的时候文件下载
                modaltitlenews: "",
                //健康资讯公用的end
                //电话咨询申请的start
                phoneapply: {
                    id: "",
                    text: "",
                    serviceid: "",
                }
                //电话咨询申请的end
            }
        },
        components: {
            moduleHead, menuList, memberEdit, healtalkEdit, healtalkDele, healtalkVerify, healnewsEdit, healnewsDele, healnewsVerify, healinteractEdit, healinteractDele, healinteractVerify, revisitRecord, commonBox2
            // ,criticalValues,mattersToday
        },
        ready() {
            var that = this;
            //获取代办事项列表
            this.getAffairList();
            // 定期回访的下次访问日期的时间选择
            laydate({
                elem: "#nextrevisitDate",
                min: laydate.now(), //设定最小日期为当前日期
                choose: function(datas) { //选择日期完毕的回调
                    that.revisitscheduledata.revisitDate = datas;
                }
            });
            // 获取健康顾问列表
            $.when(Public.commonajax("coms.doctorService", "findHealthDoctor", "[[]]"))
                .done(function(res) {
                    if (res.code == 200) {
                        that.HealthDoctorlist = res.body;
                    }
                });
            //获取危急值列表
            this.queryDangerIndexRecordListOnWeb();
        },
        methods: {
            //获取代办事项列表
            getAffairList() {
                    var that = this;
                    $.when(Public.commonajax("coms.affairService", "findAffairList", "[]"))
                        .done(function(res) {
                            if (res.code == 200) {
                                $.each(res.body, function(index, el) {
                                    if (that.strlen(el.affairDesc) > 64) {
                                        el.iswarp = true
                                    } else {
                                        el.iswarp = false
                                    }
                                });
                                that.affairServicelist = res.body;
                                // console.log('协助病人进协助病人进协助病人进协助病人进协助病人进协助病人进协助'.length);
                                // console.log(that.affairServicelist[0].affairDesc);
                                // console.log(that.affairServicelist[0].affairDesc.length);
                            }

                        });
                },
                //获取危急值列表
                queryDangerIndexRecordListOnWeb(){
                    var that = this;
                     $.when(Public.commonajax("coms.dangerIndexRecordService", "queryDangerIndexRecordListOnWeb", "[]"))
                .done(function(res) {
                    if (res.code == 200) {
                        $.each(res.body.list, function(index, el) {
                            el.occurTime = that.getlatesttime(el.occurTime)
                        });
                        that.dangerRecordlist = res.body.list;
                        that.roleId = res.body.roleId
                    }

                });
                },
                //刷新危险值列表
                refresh(){
                    this.queryDangerIndexRecordListOnWeb();
                },
                // 点击列表的按钮处理事件，locateUrl为空的不跳转，不跳转locateUrl必须为null
                dealaffair(subitem, item, index) {
                    var that = this;
                    // 如果没有跳转的url  operateId操作ID  affairTypeId事项ID
                    if (subitem.locateUrl == null) {
                        // affairTypeId == 1会员入会信息完善 affairTypeId == 2新增慢病信息完善
                        if (subitem.affairTypeId == 2 || subitem.affairTypeId == 1) {
                            if (subitem.operateId == 1 || subitem.operateId == 3) {
                                $(".bg_master2").show();
                                $("#edit_member").show();
                                this.$refs.memberedit.getmipiid(item.bussinessDataKey);
                            } else {
                                $("#successsaveinfo").modal("show");

                            }

                        };
                        //主管医生变更审核
                        if (subitem.affairTypeId == 3) {
                            $("#editexamine").modal("show");
                            // 根据对应的iD获取对应的慢病医生主管医生变更审核
                            $.when(Public.commonajax("coms.doctorService", "findChangeInfoByChangeId", "['" + item.bussinessDataKey + "']"))
                                .done(function(res) {
                                    if (res.code == 200) {
                                        that.examineinfo.sub.changeId = res.body.changeId;
                                        that.examineinfo.sub.refuseReason = '';
                                        that.examineinfo.sub.applyStatus = '';
                                        that.examineinfo.look = res.body;
                                    }

                                })
                        };
                        //分配健康顾问
                        if (subitem.affairTypeId == 4) {
                            this.selecthealdoc = "";
                            $("#sethealdoc").modal("show");
                            this.usermpiId = item.bussinessDataKey;
                            // 设置健康顾问需要显示一下会员基本信息 姓名 性别 年龄 手机号
                            $.when(Public.commonajax("coms.personService", "getSelfInfo", "['" + item.bussinessDataKey + "']"))
                                .done(function(res) {
                                    if (res.code == 200) {
                                        that.selfInfo = res.body.person;
                                        var d = new Date();
                                        var year = d.getFullYear();
                                        that.selfInfo.dob = parseInt(year) - parseInt(that.selfInfo.dob.substring(0, 4))
                                    }

                                })
                        };
                        // 备忘录
                        if (subitem.affairTypeId == 5) {
                            $("#successsaveinfo").modal("show");
                        };
                        // 健康讲座审核
                        if (subitem.affairTypeId == 9) {
                            this.verifyhealthtalk(item.bussinessDataKey);
                        };
                        //电话咨询申请
                        if (subitem.affairTypeId == 13) {
                            if (subitem.operateId == 18) { //同意
                                this.phoneapply.id = "02";
                                this.phoneapply.text = "同意电话咨询申请!";
                            } else { //拒绝
                                this.phoneapply.id = "03";
                                this.phoneapply.text = "拒绝电话咨询申请!";
                            }
                            this.phoneapply.serviceid = item.bussinessDataKey;
                            this.phoneapplymodal();
                        };
                        // 健康讲座修改作废
                        if (subitem.affairTypeId == 10) {
                            if (subitem.operateId == 14) { //修改

                                this.addhealthtalk(item.bussinessDataKey);

                            } else { //作废subitem.operateId == 15
                                this.delehealthtalk(item.bussinessDataKey);
                            }
                        }
                        // 健康资讯审核
                        if (subitem.affairTypeId == 14) {
                            this.verifyhealthnews(item.bussinessDataKey);
                        }
                        // 健康资讯修改作废
                        if (subitem.affairTypeId == 15) {
                            if (subitem.operateId == 21) { //修改
                                this.addhealthnews(item.bussinessDataKey);
                            } else { //作废subitem.operateId == 22
                                this.delehealthnews(item.bussinessDataKey);
                            }
                        }
                        // 健康互动审核
                        if (subitem.affairTypeId == 16) {
                            this.verifyhealthinteract(item.bussinessDataKey);
                        }
                        // 健康互动修改作废
                        if (subitem.affairTypeId == 17) {
                            if (subitem.operateId == 24) { //修改
                                this.addhealthinteract(item.bussinessDataKey);
                            } else { //作废subitem.operateId == 25
                                this.delehealthinteract(item.bussinessDataKey);
                            }
                        }
                        // 健康定期回访
                        if (subitem.affairTypeId == 11) {
                            this.$refs.revisitrecordmodel.revisitrecordmodel(item.bussinessDataKey);

                        }
                        this.affair = item;
                        this.affairindex = index;
                    } else { // 有跳转的url

                    }

                },
                // 改变待办事项为完成状态
                dealed() {
                    var that = this;
                    $.when(Public.commonajax("coms.affairService", "updateAffairDealFlag", "['" + this.affair.affairId + "']"))
                        .done(function(res) {
                            if (res.code == 200) {
                                $("#successsaveinfo").modal("hide");
                                that.affair.dealFlag = "1";
                                that.affairServicelist.splice(that.affairindex, 1);
                                that.affairServicelist.push(that.affair)
                            }

                        })
                },
                // 更换主管医生提交
                subexamine() {
                    var that = this;
                    $.when(Public.commonajax("coms.doctorService", "submitModifyMainDoctor", "[" + JSON.stringify(this.examineinfo.sub) + "]"))
                        .done(function(res) {
                            if (res.code == 200) {
                                $("#editexamine").modal('hide');
                                that.dealed();
                            }
                        })
                },
                // 确定设置健康顾问
                changehealdoc() {
                    var that = this;
                    $.when(Public.commonajax("coms.doctorService", "saveHealthDoctor", "['" + this.usermpiId + "','" + this.selecthealdoc + "']"))
                        .done(function(res) {
                            if (res.code == 200) {
                                Public.ajaxPrompt('设置成功');
                                $("#sethealdoc").modal("hide");
                                that.dealed();
                            } else {
                                Public.ajaxPrompt(res.msg);
                            }

                        })
                },
                //审核健康讲座
                verifyhealthtalk(lectureId) {
                    var that = this;
                    $.when(Public.commonajax("coms.healthLecturesService", "getHealthLectures", "['" + lectureId + "'']"))
                        .done(function(res) {
                            if (res.code == 200) {
                                that.gethttime(res.body); //处理健康讲座的时间
                                that.$refs.verifyhealthtalk.verifyhealthtalk(res.body);

                            }
                        })
                },
                //修改健康讲座
                addhealthtalk(lectureId) {
                    var that = this;
                    $.when(Public.commonajax("coms.healthLecturesService", "getHealthLectures", "['" + lectureId + "'']"))
                        .done(function(res) {
                            if (res.code == 200) {
                                that.gethttime(res.body); //处理健康讲座的时间
                                that.$refs.addhealthtalk.addhealthtalk(res.body);

                            }
                        })
                },
                //删除健康讲座
                delehealthtalk(lectureId) {
                    var that = this;
                    $.when(Public.commonajax("coms.healthLecturesService", "getHealthLectures", "['" + lectureId + "'']"))
                        .done(function(res) {
                            if (res.code == 200) {
                                that.gethttime(res.body); //处理健康讲座的时间
                                that.$refs.delehealthtalk.delehealthtalk(res.body);

                            }
                        })
                },
                //审核健康资讯
                verifyhealthnews(infoId) {
                    var that = this;
                    var opt = `['${infoId}',null]`;
                    $.when(Public.commonajax("coms.healthMessageService", "getHealthMessage", opt))
                        .done(function(res) {
                            if (res.code == 200) {
                                res.body.healthMessage.infoTitlePicture = Public.IMGVIEW_URL() + res.body.healthMessage.infoTitlePicture;
                                that.$refs.verifyhealthnews.verifyhealthnews(res.body.healthMessage);
                            }
                        })
                },
                //修改健康资讯
                addhealthnews(infoId) {
                    var that = this;
                    var opt = `['${infoId}',null]`;
                    $.when(Public.commonajax("coms.healthMessageService", "getHealthMessage", opt))
                        .done(function(res) {
                            if (res.code == 200) {
                                res.body.healthMessage.infoTitlePicture = Public.IMGVIEW_URL() + res.body.healthMessage.infoTitlePicture;
                                that.$refs.addhealthnews.addhealthnews(res.body.healthMessage);
                                console.log(res.body.healthMessage);

                            }
                        })
                },
                //删除健康资讯
                delehealthnews(infoId) {
                    var that = this;
                    var opt = `['${infoId}',null]`;
                    $.when(Public.commonajax("coms.healthMessageService", "getHealthMessage", opt))
                        .done(function(res) {
                            if (res.code == 200) {
                                res.body.healthMessage.infoTitlePicture = Public.IMGVIEW_URL() + res.body.healthMessage.infoTitlePicture;
                                that.$refs.delehealthnews.delehealthnews(res.body.healthMessage);

                            }
                        })
                },

                //审核健康互动
                verifyhealthinteract(infoId) {
                    var that = this;
                    var opt = `['${infoId}',null]`;
                    $.when(Public.commonajax("coms.healthInteractionService", "getHealthInteraction", opt))
                        .done(function(res) {
                            if (res.code == 200) {
                                res.body.interactionyear = res.body.interactionEndTime.substring(0, 10);
                                res.body.interactiontime = res.body.interactionBeginTime.substring(10, 16) + "-" + res.body.interactionEndTime.substring(10, 16);
                                that.$refs.verifyhealthinteract.verifyhealthinteract(res.body);
                            }
                        })
                },
                //修改健康互动
                addhealthinteract(infoId) {
                    var that = this;
                    var opt = `['${infoId}',null]`;
                    $.when(Public.commonajax("coms.healthInteractionService", "getHealthInteraction", opt))
                        .done(function(res) {
                            if (res.code == 200) {
                                that.$refs.addhealthinteract.addhealthinteract(res.body);

                            }
                        })
                },
                //删除健康互动
                delehealthinteract(infoId) {
                    var that = this;
                    var opt = `['${infoId}',null]`;
                    $.when(Public.commonajax("coms.healthInteractionService", "getHealthInteraction", opt))
                        .done(function(res) {
                            if (res.code == 200) {
                                res.body.interactionyear = res.body.interactionEndTime.substring(0, 10);
                                res.body.interactiontime = res.body.interactionBeginTime.substring(10, 16) + "-" + res.body.interactionEndTime.substring(10, 16);
                                that.$refs.delehealthinteract.delehealthinteract(res.body);

                            }
                        })
                },

                // 处理健康讲座时间的方法
                gethttime(httime) {
                    httime.lectureyear = httime.lectureEndTime.substring(0, 10);
                    httime.lecturetime = httime.lectureBeginTime.substring(10, 16) + "-" + httime.lectureEndTime.substring(10, 16);
                },

                // 获取当前时间和返回时间的差
                getlatesttime(occurTime) {
                    var date1 = new Date();
                    var date2 = new Date(occurTime);
                    var s1 = date1.getTime(),
                        s2 = date2.getTime();
                    var total = (s1 - s2) / 1000;
                    var day = parseInt(total / (24 * 60 * 60)); //计算整数天数
                    var afterDay = total - day * 24 * 60 * 60; //取得算出天数后剩余的秒数
                    var hour = parseInt(afterDay / (60 * 60)); //计算整数小时数
                    var afterHour = total - day * 24 * 60 * 60 - hour * 60 * 60; //取得算出小时数后剩余的秒数
                    var min = parseInt(afterHour / 60); //计算整数分
                    var afterMin = total - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
                    if (day > 0) {
                        return day + "天前"
                    }
                    if (hour > 0) {
                        return hour + "小时前"
                    }
                    if (min > 0) {
                        return min + "分钟前"
                    }
                    if (afterMin > 0) {
                        return afterMin + "秒前"
                    }
                },
                //处理危急值
                dealdangerrecord(item) {
                    var that = this;
                    // window.location.href="inspectdangerrecord.html?dangerRecordId="+item.dangerRecordId
                    if (this.roleId == "main_doctor") {
                        if (item.sourceType == '4') {
                            window.location.href = "seleftestdangerrecord.html?dangerRecordId=" + item.dangerRecordId
                        }else {
                            window.location.href = "inspectdangerrecord.html?dangerRecordId=" + item.dangerRecordId
                        }
                    } else {
                        $("#noticeselect").modal("show");
                        // 获取危急值通知列表
                        $.when(Public.commonajax("coms.dangerIndexRecordService", "findDangerPhone", "['" + item.dangerRecordId + "']"))
                            .done(function(res) {
                                if (res.code == 200) {
                                    that.dangerNoticelist = res.body;
                                }
                            });
                    }
                },
                // 选择或者取消危急值通知的的人物
                changenoticeStauts(item) {
                    item.noticeStauts = item.noticeStauts == "0" ? "1" : "0"

                },
                // 保存选中通知的的人物
                savedangerNotice() {
                    var that = this;
                    let temarr = [];
                    $.each(this.dangerNoticelist, function(index, el) {
                        let temobj = {
                            dangerNoticeId: ""
                        };
                        if (el.noticeStauts == "1") {
                            temobj.dangerNoticeId = el.dangerNoticeId;
                            temarr.push(temobj);
                        }
                    });
                    if (temarr.length > 0) {
                        $.when(Public.commonajax("coms.dangerIndexRecordService", "saveDangerPhoneNotcie", "[" + JSON.stringify(temarr) + "]"))
                            .done(function(res) {
                                if (res.code == 200) {
                                    Public.ajaxPrompt("发送成功");
                                    $("#noticeselect").modal("hide");
                                } else {
                                    Public.ajaxPrompt(res.msg)
                                }

                            });
                    } else {
                        Public.ajaxPrompt("请至少选一个")
                    }
                },
                // 电话咨询申请同意和拒绝弹框
                phoneapplymodal() {
                    $("#phoneapply").modal("show")

                },
                // 电话咨询申请同意和拒绝确认
                phoneapplyconfirm() {
                    var that = this;
                    console.log(this.phoneapply);
                    $.when(Public.commonajax("coms.serviceRecordsService", "updateServiceRecordsState", "['" + this.phoneapply.serviceid + "','" + this.phoneapply.id + "']"))
                        .done(function(res) {
                            if (res.code == 200) {
                                Public.ajaxPrompt("处理成功");
                                $("#phoneapply").modal("hide");
                                that.dealed()
                            } else {
                                Public.ajaxPrompt(res.msg)
                            }
                        });
                },
                //返回字符串长度区分中英文中文2个 英文1个
                strlen(str) {
                    var len = 0;
                    for (var i = 0; i < str.length; i++) {
                        var c = str.charCodeAt(i);
                        //单字节加1
                        if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
                            len++;
                        } else {
                            len += 2;
                        }
                    }
                    return len;
                },

        },
        events: {
            'verifyhealthtalksave' () {
                this.getAffairList();
            },
            'healthtalksave' () {
                this.getAffairList();
            },
            'delehealthtalksave' () {
                this.getAffairList();
            },
            'verifyhealthnewssave' () {
                this.getAffairList();
            },
            'healthnewssave' () {
                this.getAffairList();
            },
            'delehealthnewssave' () {
                this.getAffairList();
            },
            'verifyhealthinteractsave' () {
                this.getAffairList();
            },
            'healthinteractsave' () {
                this.getAffairList();
            },
            'delehealthinteractsave' () {
                this.getAffairList();
            },
            'revisitrecordsave' () {
                this.getAffairList();
            },

        },
        watch: {
            "allnotice": function(val, oldval) {
                if (val) {
                    $.each(this.dangerNoticelist, function(index, el) {
                        el.noticeStauts = "1"
                    });
                } else {
                    $.each(this.dangerNoticelist, function(index, el) {
                        el.noticeStauts = "0"
                    });
                }
            }
        }

}
</script>
<style scoped>
/*主管医生*/
@import "../../assets/flex.css";
.w290 {
    margin-left:20px;
}

.w650 {
    width: 70%;
}

.index_con>div {
    height: 250px;
    -webkit-box-shadow: 0 0 10px rgba(230, 230, 230, .5);
    -moz-box-shadow: 0 0 10px rgba(230, 230, 230, .5);
    box-shadow: 0 0 10px rgba(230, 230, 230, .5);
    background: #fff;
    border-radius: 10px;
}

.index_con .list {
    overflow: auto;
}

.index_con .list li {
    height: 52px;
}

.index_con .list li p {
    height: 52px;
    line-height: 52px;
}

.index_con .list li p:nth-child(1) {
    width: 590px;
    float: left;
    padding-left: 20px;
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.index_con .list li p:nth-child(2) {
    float: right;
    padding-right: 10px
}

.index_con .list li p button {
    height: 20px;
    width: 20px;
    border: none;
    margin: 11px 0 0 5px
}

.index_con .list li p button.edit {
    background: url(../../assets/img/edit2.png) no-repeat center center;
}

.index_con .list li p button.dele {
    background: url(../../assets/img/dele2.png) no-repeat center center;
}

.index_con .list li:hover p button.edit {
    background: url(../../assets/img/edit.png) no-repeat center center;
    border-radius: 3px;
    border: #cfcfcf 1px solid
}

.index_con .list li:hover p button.dele {
    background: url(../../assets/img/dele.png) no-repeat center center;
    border-radius: 3px;
    border: #cfcfcf 1px solid
}

.index_con .list li:nth-child(2n) {
    background: #f7f7f7
}

.index_con .list li:nth-child(2n+1) {
    background: #fff
}

.index_con .list li:last-child {
    border-radius: 0 0 10px 10px
}
.zxwd{
  min-height:208px;
}
.zxwd li {
    height: 52px;
    box-sizing: border-box;
    padding: 0 10px
}

.zxwd li>span {
    display: inline-block;
    height: 32px;
    text-align: center;
    line-height: 34px;
}

.zxwd li>span:nth-child(1) {
    width: 52px;
}

.zxwd li>span:nth-child(2) {
    width: 52px;
}

.zxwd li>span:nth-child(3) {
    width: 40px;
}

.zxwd li>span:nth-child(4) {
    width: 52px;
}

.zxwd li>span:nth-child(5) {
    width: 40px;
    background: url(../../assets/img/wenda2.png) no-repeat center bottom;
}

.zxwd li:nth-child(2n) {
    background: #f7f7f7
}

.zxwd li:nth-child(2n+1) {
    background: #fff
}

.zxwd li:last-child {
    border-radius: 0 0 10px 10px
}

.h2_index {
    padding: 0 10px 0 20px;
    height: 40px;
  line-height: 40px;
}

.h2_index h2 {
    height: 40px;
    color: #fb6e52;
    line-height: 40px;
    background: url(../../assets/img/wjz.png) no-repeat left center;
    padding-left: 30px;
    font-size: 16px;
}

.h2_index a {
    display: block;
    height: 40px;
    line-height: 40px;
    float: right;
    width: 40px;
    background: url(../../assets/img/refres2.png) no-repeat center center;
    text-indent: -999rem
}

.index_con .contain {
    overflow: auto;
    height: 208px;
    width: 100%
}

.index_con .block {
    border: #e5e9ec 1px solid;
    margin: 10px 10px 0;
}

.index_con .block .block_con1 {
    padding: 0 10px;
    height: 26px;
    line-height: 26px;
    background: #f9fafc;
    color: #888888
}

.index_con .block .block_con2 {
    padding: 10px;
    color: #444444;
}

.index_con .block .block_con2 >p {
    color: #fb6e52;
}

.index_con .block .block_con2 p {
    line-height: 25px;
}

.index_con .block .block_con2>div {
    padding-left: 30px;
}

.index_con .block .block_con2>div p span:nth-child(1) {
    padding-left: 30px;
    width: 200px;
    display: inline-block;
}

.index_con .block .block_con2 .zhibiao {
    display: inline-block;
    background: url(../../assets/img/up_arrow.png) no-repeat right center;
    padding-right: 10px;
    height: 25px;
}

.index_con .block .block_con2 .zhibiao2 {
    display: inline-block;
    background: url(../../assets/img/down_arrow.png) no-repeat right center;
    padding-right: 10px;
    height: 25px;
}

.index_con .block .block_con2>button {
    color: #fb6e52;
    border: 1px solid #fb6e52;
    border-radius: 15px;
    height: 30px;
    background: none;
    padding: 0 10px;
    line-height: 30px
}

.h2_index2 {
    padding: 0 10px 0 20px;
    background: #22a7f0;
    height: 40px;
    border-radius: 10px 10px 0 0
}

.h2_index2 h2 {
    height: 40px;
    color: #fff;
    line-height: 40px;
    background: url(../../assets/img/wenda.png) no-repeat left center;
    padding-left: 30px;
    font-size: 16px;
}

.h2_index2 a {
    display: block;
    height: 40px;
    line-height: 40px;
    float: right;
    width: 40px;
    background: url(../../assets/img/refres.png) no-repeat center center;
    text-indent: -999rem
}

.need_dealt {
    height: 444px;
    -webkit-box-shadow: 0 0 10px rgba(230, 230, 230, .5);
    -moz-box-shadow: 0 0 10px rgba(230, 230, 230, .5);
    box-shadow: 0 0 10px rgba(230, 230, 230, .5);
    background: #fff;
    border-radius: 10px
}

.h2_index3 {
    padding: 0 10px 0 20px;
    height: 40px;
    border-bottom: 2px solid #ffae00;
}

.h2_index3 h2 {
    height: 40px;
    color: #ffae00;
    line-height: 40px;
    background: url(../../assets/img/daiban.png) no-repeat left center;
    padding-left: 30px;
    font-size: 16px;
}

.h2_index3 a {
    display: block;
    height: 40px;
    line-height: 40px;
    float: right;
    width: 40px;
    background: url(../../assets/img/refres2.png) no-repeat center center;
    text-indent: -999rem
}

.need_dealt .list {
    height: 400px;
    padding: 10px;
    overflow-y: auto
}

.need_dealt .list li {
    height: 52px;
    border: #e6e7eb 1px solid;
    border-radius: 5px;
    border-left: 5px solid #FDC182;
    margin-top: 10px;
}

.need_dealt .list li.over {
    border-left: 5px solid #dfdfdf;
    background: #fafafb;
    color: #999
}

.need_dealt .list li p {
    height: 52px;
    line-height: 52px;
    float: left;
    padding-left: 20px;
    overflow: hidden;
}

.need_dealt .list li p:nth-child(1) {
    width: 110px;
    font-size: 14px;
}

.need_dealt .list li p:nth-child(2) {
    width: 470px;
}

.need_dealt .list li p:nth-child(3) {
    width: 200px;
}

.need_dealt .list li p:nth-child(4) {
    width: 130px;
    padding-left: 40px;
    float: right;
    background: url(../../assets/img/jsszy/时间.png) no-repeat 10px center;
}

.need_dealt .list li.over p:nth-child(4) {
    width: 130px;
    padding-left: 40px;
    float: right;
    background: url(../../assets/img/jsszy/时间.png) no-repeat 10px center;
}

.need_dealt .list li p button.agree {
    color: #1dc499;
    border: 1px solid #1dc499;
}

.need_dealt .list li p button.disagree {
    color: #ffae00;
    border: 1px solid #ffae00;
}

.threestep_con h2 {
    margin: 20px auto;
    background: url(../../assets/img/jsszy/成功.png) no-repeat 115px center;
    padding-left: 60px;
    color: #9E3110;
    text-align: center;
    height: 64px;
    line-height: 64px;
    font-size: 20px
}


/*更换主管医生审核提交*/

.changeinfo {
    background: #1dc499;
    padding-bottom: 20px;
}

.changeinfo .changeinfo_head {
    color: #fff;
    height: 40px;
    line-height: 40px;
    margin: 0 auto;
    width: 100%;
    text-align: center;
}

.changeinfo .changeinfo_head span {
    padding-right: 20px
}

.changeinfo_con {
    background: #fff;
    border-radius: 20px;
    width: 460px;
    min-height: 218px;
    margin: 0 auto;
    padding: 20px;
    border: 3px solid #eeeeee
}

.changeinfo_con p {
    display: inline-block;
    color: #999999;
    font-size: 12px;
}

.changeinfo_con .content1 {
    padding-left: 20px
}

.changeinfo_con .content1 p:nth-child(1) {
    margin: 0 10px 10px 0
}

.changeinfo_con .content1 p:nth-child(2) {
    width: 200px
}

.changeinfo_con .content1 p span {
    color: #19ab85;
    font-size: 14px;
    margin-right: 10px
}

.changeinfo_con .content2 {
    padding-left: 18px
}

.changeinfo_con .content2 p {
    width: 150px;
    color: #333333;
    text-align: center;
}

.changeinfo_con .content2 p:nth-child(2) {
    width: 70px;
    color: #999999;
}

.changeinfo_con .content2 img {
    display: block;
    margin: 0 auto 10px;
}

.changeinfo_con .content2 p:nth-child(2) img {
    display: block;
    margin: 0 auto 30px;
}

.changeinfo_con .content2 p span {
    margin-right: 10px
}

.changeinfo_con .content3 {
    margin-top: 20px;
    color: #999;
    font-size: 12px;
    padding-left: 20px;
    width: 400px;
    word-wrap: break-word
}

.changeinfo_con .content3 span {
    float: left;
}

.tbline {
    height: 60px;
    padding-top: 20px
}

.selectnoticepeople ul {
    width: 100%;
    margin: 0 auto;
}

.selectnoticepeople ul li {
    padding: 10px 0 10px;
    width: 130px;
    height: 170px;
    float: left;
    margin-left: 10px;
    border-radius: 10px;
    border: 2px solid #4796f2;
    position: relative;
}

.selectnoticepeople ul li:hover {
    cursor: pointer;
}

.selectnoticepeople ul li .righttip {
    position: absolute;
    width: 34px;
    height: 34px;
    background: url(../../assets/img/tipbg1.jpg) no-repeat center center;
    top: 0;
    right: 0;
}

.selectnoticepeople ul li.noselect {
    border: 2px solid #979797;
    position: relative;
}

.selectnoticepeople ul li .righttip2 {
    background: url(../../assets/img/tipbg2.jpg) no-repeat center center;
}

.selectnoticepeople ul li p {
    line-height: 30px;
    height: 30px;
    text-align: center;
}

.selectnoticepeople ul li img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: block;
    margin: 15px auto;
}

.selectnoticepeople ul li p:nth-child(2) {
    color: #1dc499
}

.selectnoticepeople ul li p:nth-child(2) span {
    color: #A9A9A9
}

.selectnoticepeople ul li p.iphone {
    background: url(../../assets/img/iphone.png) no-repeat 10px center;
    padding-left: 20px;
}

.need_dealt .list li p.lh24 {
    line-height: 24px
}
</style>
